package com.alibaba.cloud.boot.stock.controller;


import com.alibaba.cloud.boot.order.facade.StockFacade;
import com.alibaba.cloud.boot.stock.entity.TStock;
import com.alibaba.cloud.boot.stock.mapper.TStockMapper;
import com.alibaba.cloud.boot.stock.service.ITStockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xrr
 * @since 2024-02-13
 */
@RestController
@RequestMapping("/stock")
public class TStockController implements StockFacade {

    @Autowired
    private ITStockService stockService;

    @Override
    @GetMapping("/reduceStockCount")
    public String reduceStockCount(int stockId, int stockCount) {

        return stockService.reduceStockCount(stockId,stockCount);
    }

    @Override
    @GetMapping("/mustFail")
    public String mustFail() {
       throw new RuntimeException("gg");
    }
}
